// effect_break

local effect_break = Assault.Entities:New("effect_break")

// On entity created

function effect_break:OnEntityCreated()
	local Size = self:EntityGetMaxLength() / 16
	local Position = self:EntityGetPosition()
	
	// X and Y
	
	local X = Position.X
	local Y = Position.Y
	
	// Color
	
	local Material = self:EntityGetMaterial()
	local Color = self:EntityGetColor()
	
	// Sparks
	
	for I = 1, 4 do
		Assault.Entities.EntitiesQuickCreate("effect_sparks", Assault.Vector:New(X + math.random(-(Size * I), Size * I), Y + math.random(-(Size * I), Size * I)), false, false, Color, {Width = Size}):EntitySetMaterial(Material)
		Assault.Entities.EntitiesQuickCreate("effect_sparks", Assault.Vector:New(X + math.random(-(Size * I), Size * I), Y + math.random(-(Size * I), Size * I)), false, false, Color, {Width = Size}):EntitySetMaterial(Material)
		Assault.Entities.EntitiesQuickCreate("effect_sparks", Assault.Vector:New(X + math.random(-(Size * I), Size * I), Y + math.random(-(Size * I), Size * I)), false, false, Color, {Width = Size}):EntitySetMaterial(Material)
	end
	
	// Remove entity
	
	self:EntityRemove()
end

// On entity collision

function effect_break:OnEntityCanCollide(Entity)
	return false
end

// On entity paint

function effect_break:OnEntityPaint()
	return false
end

// Create

effect_break:Create()